package com.liss.boot.design.creation.d01.singleton;

public class Person {
    private String name;
    private String age;

    private volatile static Person instance;//饿汉

    private Person() {
        System.out.println("创建了person");
    }

    public static Person getBoss(){
        if (instance == null){
            synchronized (Person.class){
                if (instance == null){
                    instance = new Person();
                }
            }
        }
        return instance;
    }
}
